<template>
    <div class="systemItem" @click="goTongzhi(item)">
        <div class="title">
            <span v-html="item.info"></span>
            <span
                v-if="item.type == 14 && item.quiz_id"
                class="ljgt"
                @click.stop="ljgt(item)"
                >立即沟通</span
            >
        </div>
        <div class="time">{{ getTime(item.createtime * 1000) }}</div>
    </div>
</template>
  
<script>
import { getTime } from "@/assets/utils/utils";
export default {
    name: "systemItem",
    props: {
        item: {
            type: Object,
            default: () => {
                return {};
            },
        },
    },
    data() {
        return {
            getTime: getTime,
        };
    },
    computed: {},
    mounted() {},
    methods: {
        ljgt(item) {
            const token = window.localStorage.getItem('token')
            if (!token) {
                this.$confirm("该功能需要登录后使用", "提示", {
                    confirmButtonText: "去登录",
                    cancelButtonText: "再看看",
                })
                    .then(() => {
                        this.$router.push({
                            path: "/login",
                            query: {
                                url:
                                    window.location.pathname +
                                    window.location.search,
                            },
                        });
                    })
                    .catch(() => {});
                return;
            }
            localStorage.setItem("to_zim_userid", item.quiz_id);
            this.$router.push({
                path: "/service/servicechat",
            });
        },
        goTongzhi(item) {
            if (item.type == 13) {
                this.$router.push({
                    path: "/service/shoporder",
                    query: {
                        orderNo: item.from_id,
                    },
                });
                return;
            }
            if (item.type == 14) {
                this.$router.push({
                    path: "/service/demanddetail",
                    query: {
                        id: item.from_id,
                    },
                });
                return;
            }
            if (item.quiz_status == 2) {
                this.$router.push({
                    path: `/chat/${item.quiz_id}`
                });
               
            } else if (item.quiz_status == 3) {
                let { href } = this.$router.resolve({
                    path: `/cswd/${item.quiz_id}.html`,
                });
                window.open(href, "_blank");
            }else if(item.url == '1'){
                this.$router.push({
                    path: "/user/myvip",
                });
            }else if(item.url == '5'){
                this.$router.push({
                    path: "/user/mycoupon",
                });
            }
        },
    },
};
</script>
<style lang="scss" scoped>
.systemItem {
    padding: 20px 40px 0;
    border-bottom: 1px solid #ebebeb;
    cursor: pointer;
    &:hover {
        background: #f7f9fb;
    }
}

.ljgt {
    border-bottom: 1px solid #1c87f3;
    color: #1c87f3;
    display: inline-block;
    margin-left: 5px;
}
.title {
    font-size: 18px;
    color: #333333;
    margin-bottom: 8px;
    // -webkit-line-clamp: 2;
    // display: -webkit-box;
    // -webkit-box-orient: vertical;
    // overflow: hidden;
    // text-overflow: ellipsis;
}

.time {
    font-size: 14px;
    color: #999999;
    padding-bottom: 18px;
}

::v-deep em {
    color: #1c87f3;
}
</style>
  